<template>
    <div class="statement" v-loading="loading">
        <div class="statement-top">
            <p>工资报表</p>
        </div>
        <exportExcel :statementList="statementList"></exportExcel>
        <!-- 表格 -->
        <div>
            <el-table :data="statementList" style="width: 100%" border>
                <el-table-column prop="date" label="序号" type="index" width="80" />
                <el-table-column prop="departmentName" label="姓名" width="130" />
                <el-table-column prop="mobile" label="手机号" width="130" />
                <el-table-column prop="workNumber" label="工号" width="130" />
                <el-table-column prop="username" label="部门名称" width="130" />
                <el-table-column prop="providentFundIndividual" label="公积金个人" width="130" />
                <el-table-column prop="socialSecurityIndividual" label="社保个人" width="130" />
                <el-table-column prop="providentFundEnterprises" label="社保企业" width="130" />
                <el-table-column prop="socialSecurityProvidentFundEnterprises" label="公积金企业" width="130" />
                <el-table-column prop="address" label="基本工资" />
                <el-table-column prop="address" label="岗位工资" />
                <el-table-column prop="address" label="福利津贴" />
                <el-table-column prop="address" label="考勤扣款" />
                <el-table-column prop="address" label="税前工资合计" />
                <el-table-column prop="address" label="应缴纳税工资" />
                <el-table-column prop="address" label="应扣税" />
                <el-table-column prop="address" label="实际工资" />
            </el-table>
        </div>
        <!-- 底部 -->
        <div class="statement-bottom">
            <el-button type="primary" @click="archiveReportList">归档11报表</el-button>
            <el-button type="primary" @click="createReportList">创建报表</el-button>
            <el-button @click="$router.go(-1)">取消</el-button>
        </div>
    </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { useRoute } from "vue-router"
import exportExcel from "@/components/exportExcel.vue"
import { getOrgList, archiveReport, createReport } from "@/api/wageApi/statementApi.js"
import { ElMOpen } from "@/utils/fn.js"
let route = useRoute()
let loading = ref(false)
let statementList = ref([])
setTimeout(() => {
    loading.value = true
    getOrgList(route.query.id).then(res => {
        statementList.value = res.data
        loading.value = false
    }, 2000)
})

// 归档
let archiveReportList = () => {
    archiveReport(route.query.id).then(res => {
        console.log(res);
        ElMOpen('归档成功', "success")
    })
}

// 创建报表
let createReportList = () => {
    createReport(route.query.id).then((res) => {
        ElMOpen('创建报表成功', "success")
    })
    // ElMOpen('创建报表成功',"success")
}



</script>

<style scoped lang="scss">
.statement {
    height: calc(100vh - 100px);
    width: 100%;
    background: #fff;
    padding: 20px;
    box-sizing: border-box;
    overflow: auto;
}

.statement-bottom {
    height: 60px;
    line-height: 60px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.statement-top {
    height: 60px;
    line-height: 60px;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #eee;

    p {
        width: 100px;
        text-align: center;
        border-bottom: 2px solid #000;
    }
}
</style>